﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Web.View.userInfo.Default" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>中国云--WebMisDeveloper个人信息管理</title>
    <script type="text/javascript">
        var GetRoleName = function (value) {
            index = S_Roles.find("roleid", value, 0, false, false);
            return S_Roles.getAt(index).get('rolename');
              }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Store runat="server" ID="S_Roles" OnRefreshData="GetAllRoles" AutoLoad="true">
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="roleid">
                <Fields>
                    <ext:RecordField Name="roleid" />
                    <ext:RecordField Name="rolename" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
        <ext:Store ID="userinfo_Store" runat="server" OnRefreshData="InfoBind" AutoLoad="true"
            ShowWarningOnFailure="false"
            OnBeforeStoreChanged="HandleChanges" 
            SkipIdForNewRecords="false"
            RefreshAfterSaving="None"
        >
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="userid">
                <Fields>
                    <ext:RecordField Name="userid" />
                    <ext:RecordField Name="username" />
                    <ext:RecordField Name="roleid" />
                    <ext:RecordField Name="telephone" />
                    <ext:RecordField Name="usersex" />
                    <ext:RecordField Name="address" />
                    <ext:RecordField Name="email" />
                    <ext:RecordField Name="password" />
                    <ext:RecordField Name="logintime" />
                    <ext:RecordField Name="createtime" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Viewport ID="Viewport1" runat="server">
        <Items>
            <ext:FitLayout ID="FitLayout1" runat="server">
                <Items>
                    <ext:GridPanel ID="GridPanel1" Layout="fit" TrackMouseOver="true" runat="server"
                        StoreID="userinfo_Store" StripeRows="true" Header="false" Border="false" Collapsible="true">
                        <Plugins>
                            <ext:RowEditor ID="RowEditor1" runat="server" SaveText="更新" CancelText="取消" >
                            </ext:RowEditor>
                        </Plugins>
                        <View>
                            <ext:GridView ID="GridView1" runat="server" MarkDirty="false" />
                        </View>

                        <TopBar>
                            <ext:Toolbar ID="Toolbar1" runat="server">
                                <Items>
                                    <ext:Button ID="Button1" runat="server" Text="保存修改" Icon="Disk">
                                        <Listeners>
                                            <Click Handler="#{GridPanel1}.save();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarSeparator></ext:ToolbarSeparator>
                                    <ext:Button ID="Button3" runat="server" Text="重新加载" Icon="Reload">
                                        <Listeners>
                                            <Click Handler="#{S_Roles}.reload();#{userinfo_Store}.reload();" />
                                        </Listeners>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <ColumnModel ID="ColumnModel1" runat="server">
                            <Columns>
                                <ext:RowNumbererColumn Width="20" />
                                <ext:Column Header="用户ID" Sortable="true" Hidden="true" DataIndex="userid" />
                                <ext:Column Header="用户名" Sortable="true" DataIndex="username" >
                                </ext:Column>
                                <ext:Column Header="性别" Sortable="true" DataIndex="usersex" >
                                    <Editor>
                                        <ext:ComboBox runat="server">
                                            <Items>
                                                <ext:ListItem Text="男" Value="男" />
                                                <ext:ListItem Text="女" Value="女" />
                                            </Items>
                                        </ext:ComboBox>
                                    </Editor>
                                </ext:Column>
                                <ext:Column Header="电话" Sortable="true" DataIndex="telephone" >
                                    <Editor>
                                        <ext:TextField runat="server" />
                                    </Editor>
                                </ext:Column>
                                <ext:Column Header="地址" Sortable="true" Width="150" DataIndex="address" >
                                    <Editor>
                                        <ext:TextField runat="server" />
                                    </Editor>
                                </ext:Column>
                                <ext:Column Header="邮箱" Sortable="true" Width="200" DataIndex="email" >
                                    <Editor>
                                        <ext:TextField Vtype="email" runat="server" AllowBlank="false" />
                                    </Editor>
                                </ext:Column>
                                 <ext:Column Header="最后登录" Sortable="true" DataIndex="logintime" />
                                <ext:Column Header="创建时间" Sortable="true" DataIndex="createtime" />
                                <ext:Column Header="角色" Sortable="true" DataIndex="roleid">
                                    <Renderer Fn="GetRoleName" />
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <LoadMask ShowMask="true" Msg="正在加载..." />
                    </ext:GridPanel>
                </Items>
            </ext:FitLayout>
        </Items>
    </ext:Viewport>
    </form>
</body>
</html>
